package com.hmall.Interceptor;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebMvcInterceptorConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 添加自定义的AuthorizationInterceptor拦截器
        registry.addInterceptor(new AuthorizationInterceptor())
                .addPathPatterns("/**"); // 设置拦截的路径模式，这里表示拦截所有请求路径
    }
}